package com.example.chapter04;

/**
 * @author myh
 * @date 2024/4/29
 */
public class Literals {
    public static void main(String[] args) {
    int i1 = 0x2f; //十六进制(小写)
    System.out.println("i1: " + Integer.toBinaryString(i1));
    int i2 = 0X2F; //十六进制(大写)
    System.out.println ("i2: " + Integer.toBinaryString(i2));
    int i3 = 0177; // 八进制(前5.0)
    System.out.println("i3: " + Integer.toBinaryString(i3));
    char c = 0xffff; // char类型的最大十六进制值
    System.out.println("c: " + Integer. toBinaryString(c));
    byte b = 0x7f; // byte类型的最大十六进制值
    System.out.println("b: " + Integer.toBinaryString(b));
    short s = 0x7fff; // short类型的最大十六进制值
    System.out.println("s: " + Integer.toBinaryString(s));
    long nl = 200L; // long 类型后缀
    long n2 = 2001; // long类型后缀(很容易让人困惑)
    long n3 = 200;
    // Java 7的二进制字面量：
    byte blb = (byte)0b00110101;
    System.out.println("blb: " + Integer.toBinaryString(blb));
    short bls = (short)0B0010111110101111;
    System.out.println("bls: " + Integer.toBinaryString(bls));
    int bli = 0b001011010101111101011111010011;
    System.out.println("bli: " + Integer.toBinaryString(bli));
    long bll = 0b00101111101011111010111110101111;
    System.out.println("bll333333333: " + Long. toBinaryString(bll));
    float fl = 1;
    float f2 = 1F; // float 类型后缀
    float f3 = 1f; // float 类型后缀
    double d1 = 1d; // double 类型后缀
    double d2 = 1D; // double 类型后缀
    //(十六进割和八遼制也都能作为long矣型住用)
    }
}
